package com.nobody.facepk.service;

import java.util.List;
import java.util.Random;
import java.util.concurrent.CopyOnWriteArrayList;

import org.springframework.stereotype.Service;

@Service
public class PictureManager {
	private List<Long> pictures = new CopyOnWriteArrayList<Long>();
	
	public void addNewPicture(Long pictureId) {
		this.pictures.add(pictureId);
	}
	
	public Long getRandomPicture() {
		int rnd = new Random().nextInt(this.pictures.size());
		return this.pictures.get(rnd);
	}
	
	public void removePicture(Long pictureId) {
		this.pictures.remove(pictureId);
	}
	
	public boolean isEmpty() {
		return this.pictures.isEmpty();
	}
}
